home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Cplaplet.pxl
< prev
next >
Wrap
Text File
|
2000-04-01
|
5KB
|
200 lines
{ Filename : CPLapplets.pxl
Purpose : Windows shell and applets
Date : 20 aug 98
Author : S.Dibbs, VYSOR Integration Inc
History:
Version : 1.0 RELEASE
Update :
Date :
--------------------------------------------------------------------------}
Initialize: {only one instance allowed}
UseCoordinates(PIXEL)
Title$ = "PiXCL 4.4 and the Control Panel Applets"
WinExist(Title$,Res)
If Res = 0 Then Goto One_Instance
Beep
WinSetActive(Title$,Res)
WinShow(Title$,RESTORE,Res)
End
One_Instance:
WAVPlaySound("cplaplets.wav",ASYNC,FILENAME,Res)
UseCaption(Title$) {change the title}
WinLocate(Title$,472,188,970,594,Res)
UseBackground(TRANSPARENT,0,128,128)
WinShow(Title$,NOTOPMOST,Res)
DrawBackGround
DirGet(SourceDir$) {used later for library function calls}
DirGetWindows(WinDir$)
DirGetSystem(WinSys$)
WinVersion(Major,Minor,Build,Pack$)
{
DrawNumber(10,30, Major)
DrawNumber(60,30, Minor)
DrawNumber(100,30, Build)
DrawText(10,50,Pack$)
}
{ locate rundll32.exe }
RunDLL$ = WinDir$ + "\rundll32.exe"
FileExist(RunDLL$,Res)
If Res = 0
RunDLLDir$ = WinSys$
Else
RunDLLDir$ = WinDir$
Endif
InfoMenu(REMOVE)
WaitInput(100)
SetMenu("&File",IGNORE,
"&New",CreatingFile,
"&Test Applets",OpeningFile,
"&Format Floppy",FormatFloppy,
SEPARATOR,
"E&xit!",Terminate,
ENDPOPUP,
"&View",IGNORE,
"&ToolBar",ViewToolBar,
"&StatusBar",ViewStatusBar,
ENDPOPUP,
"&Information",IGNORE,
"&Concept",Concept,
"&Help",ShowAppHelp,
SEPARATOR,
"&About",About,
ENDPOPUP)
GoSub MakeToolbar
ChangeMenuItem("&ToolBar",CHECK,TBRes)
StatusWindow(ENABLE,BOTTOM,2,500,-1,0,0)
DrawStatusWinText(0,"Ready")
ChangeMenuItem("&StatusBar",CHECK,SBRes)
Wait_for_Input:
WaitInput()
Terminate:
End
Concept:
MessageBox(OK,1,INFORMATION,
"This sample file opens the various control panel applet files
located in the Windows system directory, and demonstrates the
functions available within the applet.",
Title$,Res)
Goto Wait_for_Input
ShowAppHelp:
{An application Help file usually has the same name as the application.}
Winhelp("cplaplet.hlp",CONTENTS,"")
Goto Wait_for_Input
About:
AboutUser(Title$,
"Identifying the Control Panel Applets.",
"Selects a Control Panel applet and check the contents by running a Windows shell command.")
Goto Wait_for_Input
ViewToolBar:
GetMenuStatus("&ToolBar",CHECKED,Res)
If Res = 0
GoSub MakeToolbar
ChangeMenuItem("&ToolBar",CHECK,Res)
Else
Toolbar()
ChangeMenuItem("&ToolBar",UNCHECK,Res)
Endif
Goto Wait_for_Input
ViewStatusBar:
GetMenuStatus("&StatusBar",CHECKED, Res)
If Res = 0
StatusWindow(ENABLE,BOTTOM,2,500,-1,0,0)
DrawStatusWinText(0,"Ready")
ChangeMenuItem("&StatusBar",CHECK,Res)
Else
StatusWindow(DISABLE,BOTTOM,2,500,-1,0,0)
ChangeMenuItem("&StatusBar",UNCHECK,Res)
Endif
Goto Wait_for_Input
CreatingFile:
{TODO: add file handling here}
MessageBox(OK,1,EXCLAMATION,"Look at the source code, at label 'CreatingFile:'","No function coded for this button",Res)
Goto Wait_for_Input
OpeningFile:
WaitInput(1)
WAVPlaySound("opencpl.wav",ASYNC,FILENAME,Res)
Filter$ = "Control Panel Applets (*.cpl),*.cpl"
InitFile$ = "*.cpl"
Label$ = "Select a Control Panel Applet file to examine."
FileGet(Filter$,InitFile$,WinSys$,Label$,CHANGEDIR,CPLfile$)
If CPLfile$ = "" Then Goto Wait_for_Input
{Loop through the CPL file arguments and see what these applets do}
Ansi("0",Index)
Cmd$ = RunDLLDir$ + "\rundll32.exe shell32.dll,Control_RunDLL "
Cmd$ = Cmd$ + CPLfile$
Cmd$ = Cmd$ + ",@"
Chr(Index,App$)
CmdLine$ = Cmd$ + App$
{CmdLine$ = CmdLine$ + ",1" } {add extra to select property page}
RightOf(CmdLine$,50,Rpt$)
DrawStatusWinText(0,Rpt$)
WaitInput(100)
Run(CmdLine$)
Loop:
MessageBox(YESNO,1,QUESTION,
"Get next applet ? If no new applet dialog appears, click No",CPLfile$,Res)
If Res = 2 Then DrawStatusWinText(0,"Ready") Goto Wait_for_Input
WaitInput(100)
Index++
Chr(Index,App$)
CmdLine$ = Cmd$ + App$
{CmdLine$ = CmdLine$ + ",1" } {add extra to select property page}
RightOf(CmdLine$,50,Rpt$)
DrawStatusWinText(0,Rpt$)
WaitInput(100)
Run(CmdLine$)
Goto Loop
FormatFloppy:
WaitInput(1)
Cmd$ = RunDLLDir$ + "\rundll32.exe shell32.dll,SHFormatDrive"
Run(Cmd$)
{This displays a modeless dialog that accepts input, and PiXCL will go back to the idle
loop unless code, such as below, is used.}
{
FormatWin$ = "Format - 3╜ Floppy (A:)"
WinExist(FormatWin$,Res)
If Res = 1
While Res = 1
WinExist(FormatWin$,Res)
EndWhile
Endif
}
Goto Wait_for_Input
{--- Style Suggestion: place all subroutines at the end of the script.}
MakeToolbar: {subroutine}
Toolbar(RAISED, PXL_SMALL,
NULL, NULL, SEPARATOR, "", Wait_for_Input,
PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
PXL_OPEN, ENABLED, STD, "Test Control Panel Applets", OpeningFile,
PXL_SAVE, ENABLED, STD, "Format Floppy", FormatFloppy,
NULL, NULL, SEPARATOR, "", Wait_for_Input,
HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
Return